﻿using System;
using System.Runtime.CompilerServices;

namespace C4Net.Core.Log
{
    /// <summary>
    /// Interface for ILoggable items, able to write a log.
    /// </summary>
    public interface ILoggable
    {
        #region - Methods -

        /// <summary>
        /// Writes a message into a given logger.
        /// </summary>
        /// <param name="loggerName">Name of the logger.</param>
        /// <param name="severity">The severity of the issue.</param>
        /// <param name="message">The message.</param>
        /// <param name="className">Name of the class.</param>
        /// <param name="memberName">Name of the member.</param>
        void WriteLog(string loggerName, LogSeverity severity, string message, string className = "", [CallerMemberName] string memberName = "");

        /// <summary>
        /// Writes an exception into a given logger.
        /// </summary>
        /// <param name="loggerName">Name of the logger.</param>
        /// <param name="severity">The severity of the issue.</param>
        /// <param name="ex">The exception.</param>
        /// <param name="className">Name of the class.</param>
        /// <param name="memberName">Name of the member.</param>
        void WriteLog(string loggerName, LogSeverity severity, Exception ex, string className = "", [CallerMemberName] string memberName = "");

        /// <summary>
        /// Writes a message into the default logger.
        /// </summary>
        /// <param name="severity">The severity of the issue.</param>
        /// <param name="message">The message.</param>
        /// <param name="className">Name of the class.</param>
        /// <param name="memberName">Name of the member.</param>
        void WriteLog(LogSeverity severity, string message, string className = "", [CallerMemberName] string memberName = "");

        /// <summary>
        /// Writes an exception to the default logger.
        /// </summary>
        /// <param name="severity">The severity of the issue.</param>
        /// <param name="ex">The exception.</param>
        /// <param name="className">Name of the class.</param>
        /// <param name="memberName">Name of the member.</param>
        void WriteLog(LogSeverity severity, Exception ex, string className = "", [CallerMemberName] string memberName = "");

        /// <summary>
        /// Logs a debug message into the default logger.
        /// </summary>
        /// <param name="message">The message.</param>
        /// <param name="className">Name of the class.</param>
        /// <param name="memberName">Name of the member.</param>
        void LogDebug(string message, string className = "", [CallerMemberName] string memberName = "");

        /// <summary>
        /// Logs a debug exception into the default logger.
        /// </summary>
        /// <param name="ex">The ex.</param>
        /// <param name="className">Name of the class.</param>
        /// <param name="memberName">Name of the member.</param>
        void LogDebug(Exception ex, string className = "", [CallerMemberName] string memberName = "");

        /// <summary>
        /// Logs an information message into the default logger.
        /// </summary>
        /// <param name="message">The message.</param>
        /// <param name="className">Name of the class.</param>
        /// <param name="memberName">Name of the member.</param>
        void LogInfo(string message, string className = "", [CallerMemberName] string memberName = "");

        /// <summary>
        /// Logs an information exception into the default logger.
        /// </summary>
        /// <param name="ex">The exception.</param>
        /// <param name="className">Name of the class.</param>
        /// <param name="memberName">Name of the member.</param>
        void LogInfo(Exception ex, string className = "", [CallerMemberName] string memberName = "");

        /// <summary>
        /// Logs a warning message into the default logger.
        /// </summary>
        /// <param name="message">The message.</param>
        /// <param name="className">Name of the class.</param>
        /// <param name="memberName">Name of the member.</param>
        void LogWarning(string message, string className = "", [CallerMemberName] string memberName = "");

        /// <summary>
        /// Logs a warning exception into the default logger.
        /// </summary>
        /// <param name="ex">The exception.</param>
        /// <param name="className">Name of the class.</param>
        /// <param name="memberName">Name of the member.</param>
        void LogWarning(Exception ex, string className = "", [CallerMemberName] string memberName = "");

        /// <summary>
        /// Logs an error message into the default logger.
        /// </summary>
        /// <param name="message">The message.</param>
        /// <param name="className">Name of the class.</param>
        /// <param name="memberName">Name of the member.</param>
        void LogError(string message, string className = "", [CallerMemberName] string memberName = "");

        /// <summary>
        /// Logs an error exception into the default logger.
        /// </summary>
        /// <param name="ex">The exception.</param>
        /// <param name="className">Name of the class.</param>
        /// <param name="memberName">Name of the member.</param>
        void LogError(Exception ex, string className = "", [CallerMemberName] string memberName = "");

        /// <summary>
        /// Logs a fatal message into the default logger.
        /// </summary>
        /// <param name="message">The message.</param>
        /// <param name="className">Name of the class.</param>
        /// <param name="memberName">Name of the member.</param>
        void LogFatal(string message, string className = "", [CallerMemberName] string memberName = "");

        /// <summary>
        /// Logs a fatal exception into the default logger.
        /// </summary>
        /// <param name="ex">The exception.</param>
        /// <param name="className">Name of the class.</param>
        /// <param name="memberName">Name of the member.</param>
        void LogFatal(Exception ex, string className = "", [CallerMemberName] string memberName = "");

        #endregion
    }
}
